package cn.chenxi.hadoopproject.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum MonthEnum {
    JANUARY("01", "一月"),
    FEBRUARY("02", "二月"),
    MARCH("03", "三月"),
    APRIL("04", "四月"),
    MAY("05", "五月"),
    JUNE("06", "六月"),
    JULY("07", "七月"),
    AUGUST("08", "八月"),
    SEPTEMBER("09", "九月"),
    OCTOBER("10", "十月"),
    NOVEMBER("11", "十一月"),
    DECEMBER("12", "十二月");

    private String code;
    private String month;

    // 添加静态方法来通过 code 获取 MonthEnum 实例
    public static MonthEnum getByCode(String code) {
        for (MonthEnum month : values()) {
            if (month.getCode().equals(code)) {
                return month;
            }
        }
        throw new IllegalArgumentException("No month with code: " + code);
    }
}
